package com.zyg.Controller;

import com.zyg.entity.User;
import com.zyg.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/user")
@Slf4j
public class UserController {

    @Autowired
    private UserService loginService;

    @PostMapping("/login")
    public Map<String, String> login(@RequestBody User user) {
        log.info("登录的用户为{}", user);
        return loginService.login(user);
    }

    @PostMapping("/hello")
    public String hello() {
        return "hello";
    }

}


//eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJiYWU4MjJhNmNhNDI0YzIyOGY4NWNmNzcyYzQ3NGI4MiIsInN1YiI6IjEiLCJpc3MiOiJzZyIsImlhdCI6MTcxODk1Njg4NCwiZXhwIjoxNzE4OTYwNDg0fQ.cWZ_XT1FQ1lwJ7t-2jcv_Y6vo4WqrpfbXcDuY-juWik